// 按回调函数的返回值进行分组--练习
export function mapList(list, callback) {
    const obj = {}
    const res = []
    list.forEach(v => {
        const key = callback(v)
        const value = obj[key]
        if (value) {
            value.push(v)
        } else {
            obj[key] = [v]
        }
    })
    for (let objKey in obj) {
        res.push({ date: objKey, list: obj[objKey] })
    }
    return res
}